package com.example.mask.maskmobilesshop.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 订单信息工具类
 * 
 * @ClassName: OrderUtil
 * @author: Xlh
 * @date 2017年3月7日 下午6:21:37
 */
public class OrderUtil {

	/**
	 * 生成订单编号
	 * 
	 * @Title: createOrderNo
	 * @param: @return
	 * @return: String
	 */
	public static String createOrderNo(Integer orderType) {
		String dateStr = new SimpleDateFormat("yyyyMMdd").format(new Date());
		String randStr = RandomUtil.getRandomNumber(5);
		StringBuilder sb = new StringBuilder();

		switch (orderType) {
		case 1:
			sb.append("AZ").append(dateStr).append(randStr);
			break;
		case 2:
			sb.append("AP").append(dateStr).append(randStr);
			break;
		case 3:
			sb.append("AC").append(dateStr).append(randStr);
			break;
		case 4:
			sb.append("AH").append(dateStr).append(randStr);
			break;
		case 5:
			sb.append("BD").append(dateStr).append(randStr);
			break;
		case 6:
			sb.append("AD").append(dateStr).append(randStr);
			break;
		case 7:
			sb.append("AB").append(dateStr).append(randStr);
			break;
		}
		return sb.toString();
	}
	
	/***
	 * 生成支付单号
	 * @Title: createPayNo
	 * @param: @return
	 * @return: String
	 */
	public static String createPayNo () {
		String dateStr = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
		String randStr = RandomUtil.getRandomNumber(10);
		StringBuilder sb = new StringBuilder();
		return sb.append(dateStr).append(randStr).toString();
	}
	
}
